package vn.gq.tym.utils;

import java.io.IOException;
import java.io.InputStream;

import android.content.Context;

public class FileUtils {
	
	public static boolean isAssetFileExists(Context context, String fileName) {
		try { context.getAssets().open(fileName); } catch (IOException e) {
			return false;
		}
		return true;
	}
	
	public static String convertStreamToString(InputStream is) {
		StringBuilder output = new StringBuilder();
		int byteRead = 0;
		byte[] buffer = new byte[1024];
		try {
			while ((byteRead = is.read(buffer)) > 0) {
				output.append(new String(buffer, 0, byteRead));
			}
		} catch(IOException e) {
			e.printStackTrace();
		}
		return output.toString();
	}
	
}
